cmake_minimum_required(VERSION 3.14)
project(kylin-connectivity)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt5 COMPONENTS Widgets Network LinguistTools REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Network LinguistTools REQUIRED)

#option(ASAN_TEST "Build with -fsanitize" ON)
#if (ASAN_TEST)
#    set(CMAKE_CXX_FLAGS " -fsanitize=address -g ")
#endif ()

ADD_DEFINITIONS(-DQT_NO_KEYWORDS) # CONFIG += no_keywords qt关键字冲突

file(GLOB TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.ts")


execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/translations/generate_translations_pm.sh ${CMAKE_CURRENT_SOURCE_DIR})

set(QRC_MAIN "${CMAKE_CURRENT_SOURCE_DIR}/res/resources.qrc")

add_executable(kylin-connectivity
        main.cpp
        ${QRC_MAIN}
        )

set(SUBDIRECTORIES_MAIN
        common
        connectmanage
        discovery
        filesearch
        filetransfer
        filesync
        kylinconnectivitymanager
        plugin
        projection
        ui
        dbus
        pcscreenmanage
        third_party/plugins-simple
        )
foreach (SUBDIRECTORY_MAIN ${SUBDIRECTORIES_MAIN})
    add_subdirectory(${SUBDIRECTORY_MAIN})
endforeach ()
add_subdirectory(dsoftbus)

find_package(PkgConfig REQUIRED)

pkg_check_modules(KYSDK_ALM kysdk-alm)
target_include_directories(kylin-connectivity PUBLIC ${KYSDK_ALM_INCLUDE_DIRS})
target_link_directories(kylin-connectivity PUBLIC ${KYSDK_ALM_LIBRARY_DIRS})
target_link_libraries(kylin-connectivity PUBLIC ${KYSDK_ALM_LIBRARIES})

pkg_check_modules(KYSDK_LOG kysdk-log)
target_include_directories(kylin-connectivity PUBLIC ${KYSDK_LOG_INCLUDE_DIRS})
target_link_directories(kylin-connectivity PUBLIC ${KYSDK_LOG_LIBRARY_DIRS})
target_link_libraries(kylin-connectivity PUBLIC ${KYSDK_LOG_LIBRARIES})

pkg_check_modules(KYSDK_WAYLANDHELPER kysdk-waylandhelper)
target_include_directories(kylin-connectivity PUBLIC ${KYSDK_WAYLANDHELPER_INCLUDE_DIRS})
target_link_directories(kylin-connectivity PUBLIC ${KYSDK_WAYLANDHELPER_LIBRARY_DIRS})
target_link_libraries(kylin-connectivity PUBLIC ${KYSDK_WAYLANDHELPER_LIBRARIES})

set(TOP_DIR ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(kylin-connectivity PUBLIC ${TOP_DIR}/kabase/Qt)

target_include_directories(kylin-connectivity PRIVATE
        ${CMAKE_CURRENT_SOURCE_DIR}
        )

target_link_libraries(kylin-connectivity PRIVATE
        Qt${QT_VERSION_MAJOR}::Widgets
        mobileui
        mobile_dbus
        )

